# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=todo.txt-cli
_pkgname=${pkgname/-/_}
pkgver=2.12.0
pkgrel=1
pkgdesc="A simple and extensible shell script for managing your todo.txt file."
url="https://github.com/todotxt/todo.txt-cli"
arch="noarch"
license="GPL-3.0-or-later"
depends="bash"
subpackages="$pkgname-bash-completion:_bashcomp $pkgname-doc"
source="https://github.com/todotxt/$pkgname/releases/download/v$pkgver/$_pkgname-$pkgver.tar.gz
	README.alpine"
builddir="$srcdir/$_pkgname-$pkgver"

package() {
	install -D -m644 todo.cfg "$pkgdir"/etc/todo.cfg
	install -D -m755 todo.sh "$pkgdir"/usr/bin/todo.sh

	install -D -m644 "$srcdir"/README.alpine \
		"$pkgdir"/usr/share/doc/$pkgname/README.alpine
}

_bashcomp() {
	pkgdesc="Bash completions for $pkgname"
	depends=""
	install_if="$pkgname=$pkgver-r$pkgrel bash-completion"

	install -Dm644 "$builddir"/todo_completion \
		"$subpkgdir"/usr/share/bash-completion/completions/$pkgname
}

sha512sums="d2edf247383736ce1a2412e62b926aa63c27dfd7fc47690e7dc22b2bce69ee2cd9ea91d910d921696f4af5b6121a94fdd7a8db01d0ef5ceb57609f625a73f576  todo.txt_cli-2.12.0.tar.gz
91c1933cba346d207a5619c3ec51fe6a3b5c256f50d86bdc63debc4d246444cf59f126b49d54be47e2e1623c98312b799a0c183e96de1b22d1bb845cff5dadb3  README.alpine"
